<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <base href="<%=basePath%>">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>退役军人信息管理系统</title>
  <link rel="stylesheet" type="text/css" href="css/public.css" />
  <link rel="stylesheet" type="text/css" href="css/page.css" />
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <script type="text/javascript" src="js/public.js"></script>
  <link rel="stylesheet" type="text/css" href="css/css.css" />
  <script src="js/jquery-3.6.0.js"></script>
  <style type="text/css">
    div.admin_login{
      height: 19px;
      width: 120px;
      position: absolute;
      top:50px;
      right:50px;
    }
    div.Soldier_login{
      height: 19px;
      width: 120px;
      position: absolute;
      top:90px;
      right:50px;
    }
  </style>
  <script>
    function Enterprise_info(e){
      var formObject = {};
      var formArray =$("#form1").serializeArray();
      $.each(formArray,function(i,item){
        formObject[item.name] = item.value;
      });
      $.ajax({
        url:'Enterprise_info/login',
        headers: {
          'Content-Type': 'application/json;charset=utf-8',
        },
        type:'POST',
        data:JSON.stringify(formObject),
        dataType: "json",
        success:function(data){
          if(data.code == '0000'){
            console.log(data.message);
            alert("欢迎登录");
            window.location.href="jsp/enterprise.jsp?comAccount="+data.data;
          }
          else if(data.code=='0001'){
            console.log(data.message);
            alert("账号不存在，请重新输入！");
            window.location.reload();
          }
          else if(data.code=='0002'){
            alert("密码错误，请重新输入！");
            window.location.reload();
          }
        }
      })
    }
  </script>
</head>
<body>
<form id="form1">
  <!-- 登录body -->
  <div class="logDiv">
    <img class="logBanner" src="img/logBanner.png" />
    <div class="logGet">
      <!-- 头部提示信息 -->
      <div class="logD logDtip">
        <p class="p1">企业用户登录</p>
      </div>
      <!-- 输入框 -->
      <div class="lgD">
        <img class="img1" src="img/logName.png" /><input type="text" name="comAccount"
                                                         placeholder="输入账号" />
      </div>
      <div class="lgD">
        <img class="img1" src="img/logPwd.png" /><input type="password" name="comPassword"
                                                        placeholder="输入密码" />
      </div>
      <div class="bbD">
        <p class="bbDP">
          <span class="btn_ok btn_yes" onclick="Enterprise_info()"><input type="hidden" />登录</span>
          <a class="btn_ok btn_no" href="jsp/Enterprise_register.jsp">注册</a>
        </p>
      </div>
    </div>
    <div class="admin_login">
      <button style="background-color:rgb(238, 239, 194);border:none;"><a href="index.jsp" style="color:black"><img src="img/coin01.png" height="15px"/>管理员登录</a></button>
    </div>
    <<div class="Soldier_login">
    <button style="background-color:rgb(238, 239, 194);border:none;"><a href="jsp/Soldier_login.jsp" style="color:black"><img src="img/coin10.png" height="15px"/>退役军人登录</a></button>
  </div>
  </div>
  <!-- 登录body  end -->


  <!-- 登录页面底部 -->
  <div class="logFoot">
    <p class="p1">版权所有：退役军人信息管理</p>
    <p class="p2">123456789</p>
  </div>
  <!-- 登录页面底部end -->
</form>
</body>
</html>